how to validate if date is a weekday or weekend c#

67

c# datetime get number of week -

using System.Globalization

ISOWeek.GetWeekOfYear(DateTime date);

how to validate if date is a weekday or weekend c# -

DayOfWeek today = DateTime.Today.DayOfWeek;
if (today == DayOfWeek.Sunday || today == DayOfWeek.Saturday)
{
  ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" weekend"');", true);
}
else
{
    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" weekday"');", true);
}

Comments

Submit
0 Comments